package mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import pojo.Floor;

import java.util.List;

public interface FloorMapper {
    @Insert("INSERT INTO floor(name) VALUES (#{floorName})")
    boolean insert(@Param("floorName") String floorName) throws Exception;

    @Select("SELECT name FROM floor WHERE name like %#{name}%")
    Floor query(@Param("name") String name);

    @Select("SELECT name FROM floor")
    List<Floor> queryAll();

    @Update("Update floor SET name=#{new} WHERE name=#{old}")
    boolean update(@Param("old") String oldName,
                   @Param("new") String newName);

    boolean delete(@Param("name") String name) throws Exception;
}
